<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/home/include/init_home.jsp" %>
<%
	String ip_addr			= request.getRemoteAddr();
	String board_id			= StringUtil.nvl(request.getParameter("board_id"));
	String word_id			= StringUtil.nvl(request.getParameter("word_id"));
	String search_col		= StringUtil.nvl(request.getParameter("search_col"), "subject");
	String search_word		= StringUtil.toHan(StringUtil.nvl(request.getParameter("search_word")));
	String curr_page 		= StringUtil.nvl(request.getParameter("curr_page"), "1");

	HashMap infos = new HashMap();
	infos.put("word_id",		word_id);


	BoardDAO boardDAO 		= new BoardDAO();
	HashList wordList		= boardDAO.selectWordDetail(infos);

	if (!ip_addr.equals(wordList.get("ip_addr",0))) {
		infos.put("job_type", "UC");
		boardDAO.saveWord(infos);
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%= HOME_NAME %></title>
<link href="../css/home.css" rel="stylesheet" type="text/css">
<script>
	function btn_Update(job_type)
	{
		var strURL	= "./word_password.jsp?word_id=<%= word_id %>";
		var oResult = window.showModalDialog(strURL, null, "dialogHeight=200px;dialogWidth=300px");

		if (oResult) {
			if (oResult.result) {
				if (job_type == "U") {
					var sAction	= "./boardWrite.jsp?job_type=" + job_type;
					sAction		+= "&word_id=<%= word_id %>";
					sAction		+= "&board_id=<%= board_id%>";
					sAction		+= "&pmenu_id=<%= pmenu_id%>";
					sAction		+= "&menu_id=<%= menu_id%>";
					sAction		+= "&password=" + oResult.password;

					document.location.href = sAction;
					//document.frm.submit();
				} else if (job_type == "D") {
					if (confirm("정말로 삭제하시겠습니까?")) {
						var sAction = "./wordUpdate.do?job_type=D";
						sAction		+= "&word_id=<%= word_id %>";
						sAction		+= "&password=" + oResult.password;
						sAction		+= "&board_id=<%= board_id%>";
						sAction		+= "&pmenu_id=<%= pmenu_id%>";
						sAction		+= "&menu_id=<%= menu_id%>";

						document.location.href = sAction;
						//document.frm.submit();
					}
				}
			}
		}
	}
</script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <%@ include file="/home/include/top_menu.jsp" %>
  <tr>
    <td valign="top" align="center" class="sub_con"><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
      <!--좌측네비 시작-->
        <%@ include file="/home/include/left_menu.jsp" %>
        <!--좌측네비 끝-->
        <td width="72"></td>
        <!--컨텐츠 시작-->
        <td valign="top" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><img src="../images/sub/<%=pmenu_id %>_title_01.gif"  height="31" /></td>
                <td align="right" valign="bottom"></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="5"><img src="../images/sub/sub_line.gif" width="723" height="5" /></td>
          </tr>
          <tr>
            <td height="30"></td>
          </tr>
          <tr>
            <td class="sub_title"><%= menu_name %></td>
          </tr>
          <tr>
            <td height="40"></td>
          </tr>
          <tr>
            <td><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="2" bgcolor="#999999"></td>
              </tr>
              <tr>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr height="30">
                    <th width="103" align="center">제목</th>
                    <td width="380" class="board_title"><strong><%= wordList.get("subject",0) %></strong></td>
                    <th width="103" align="center">작성일</th>
                    <td><%= wordList.get("init_date",0) %></td>
                  </tr>
				  <tr>
					<td colspan="4" height="1" bgcolor="#cccccc"></td>
				  </tr>
				  <tr height="30">
                    <th width="103" align="center">글쓴이</th>
                    <td width="350">
						<%= wordList.get("author_name",0) %>
<%		if (!"".equals(session_dept_code)) {	%>
						 [비번:<%= wordList.get("password",0) %>]
<%		}	%>
					</td>
                    <th width="103" align="center">조회수</th>
                    <td><%= wordList.get("count",0) %></td>
                  </tr>
				  <tr>
					<td colspan="4" height="1" bgcolor="#cccccc"></td>
				  </tr>
<%		if (!"".equals(session_dept_code)) {	%>
				  <tr height="30">
                    <th width="103" align="center">이메일</th>
                    <td width="350"><%= wordList.get("email",0) %></td>
                    <th width="103" align="center">연락처</th>
                    <td><%= wordList.get("telephone",0) %></td>
                  </tr>
<%		}	%>
                </table>
				</td>
              </tr>
              <tr>
                <td height="1" bgcolor="#cccccc"></td>
              </tr>
              <tr>
                <td><table width="700" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td valign="top" style="padding-top:20px; padding-left:40px;">
						<%= wordList.get("content",0) %>
					</td>
                  </tr>
                  <tr>
                  <td height="20"></td>
                  </tr>
                  <tr>
                <td height="1" bgcolor="#999999"></td>
              </tr>
                </table></td>
              </tr>
                <td height="30"></td>
              </tr>
              <tr>
                <td align="right">
					<a href="./boardList.jsp?board_id=<%=board_id%>&pmenu_id=<%=pmenu_id%>&menu_id=<%=menu_id%>&search_col=<%=search_col%>&search_word=<%=search_word%>&curr_page=<%=curr_page%>"><img src="../images/sub/list_btn.gif" alt="목록보기" width="62" height="19" /></a>
<%	if (!wordList.get("admin_yn",0).equals("Y") || !"".equals(session_dept_code)) {	%>
		  	<a href="./boardWrite.jsp?board_id=<%= board_id %>&pmenu_id=<%=pmenu_id%>&menu_id=<%=menu_id%>"><img src="../images/sub/write02.gif" /></a>

<%		if (wordList.get("reply_yn",0).equals("Y")) {	%>
		  	<a href="./boardWrite.jsp?job_type=R&word_id=<%= word_id %>&board_id=<%= board_id %>&pmenu_id=<%=pmenu_id%>&menu_id=<%=menu_id%>"><img src="../images/sub/reply02.gif" border="0"></a>
<%		}	%>
		  	<a href="#nohref" onclick="btn_Update('U')"><img src="../images/sub/edit02.gif" border="0"></a>
		  	<a href="#nohref" onclick="btn_Update('D')"><img src="../images/sub/delete02.gif" border="0"></a>
<%	}	%>
				</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="80"></td>
          </tr>
        </table></td>
        <!--컨텐츠 끝-->
      </tr>
    </table></td>
  </tr>
  <%@ include file="/home/include/footer.jsp" %>
</table>
</body>
</html>
